<?php
/**
 * 前台留言控制器
 */
class MessageAction extends Action {

	protected $currentModel=null;

	public function _initialize()
	{
		$this->currentModel = D(MODULE_NAME);
		$this->assign('type',C('MESSAGE_TYPE'));
	}	
	
    public function index()
    {
    	if($this->isPost())
    	{
    		if($this->currentModel->create()===FALSE)
    		{
    			$this->error($this->currentModel->getError());
    		}
      		if($this->currentModel->add()!== false)
      		{
      			$this->success('成功',U('Message/index'));
      		}else
      			{
      				$this->error('失败',U('Message/index'));
      			}    		
    	}else
    		{
    			$this->display();
    		}
    }

}